package com.android.trystania.volumecontrol;

import android.app.Activity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.*;
import android.os.Bundle;
import android.widget.Spinner;
import android.media.AudioManager;
import android.content.Context;
import java.io.Serializable;

public class VolumeControl extends Activity implements OnItemSelectedListener {
	private Spinner m_spinner;
	private AudioManager m_audio;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        m_spinner = (Spinner) findViewById( R.id.Spinner01 );
        m_spinner.setOnItemSelectedListener( this );

        m_audio = (AudioManager) getApplicationContext().getSystemService( Context.AUDIO_SERVICE );
        int mode = m_audio.getRouting( AudioManager.MODE_CURRENT );
        if( mode == AudioManager.ROUTE_BLUETOOTH )
        { 
        	m_spinner.setSelection( 3 );
        }
        else if( mode == AudioManager.ROUTE_HEADSET )
        { 
        	m_spinner.setSelection( 2 );
        }
        
        initSliders();
    }
    
    public void onItemSelected( AdapterView parent, View view, int position, long id )
    {
    	int selected = m_spinner.getSelectedItemPosition();
    }
    
    public void onNothingSelected( AdapterView parent ){}
    
    private void initSliders()
    {
    	
    }
}

